package models;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import play.db.ebean.Model;

@Entity
@Table(name = "usuarios")
public class Usuarios extends Model {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE)
	@Column(name = "usua_id")
	private Integer id;
	
	@Column(name = "usua_login", nullable =  false, length = 25)
	private String login;
	
	@Column(name = "usua_pswd", nullable = false, length = 25)
	private String pswd;
	
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "pess_id_pessoas")
	private Pessoas pessoa;
	
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "perf_id_perfis", nullable = false)
	private Perfis perfil;
	
	@OneToMany(mappedBy = "lider", fetch = FetchType.LAZY)
	private List<PlanoNegocio> planoNegocios;
	
	@OneToMany(mappedBy = "ngp", fetch = FetchType.LAZY)
	private List<Analises> analises;

	public Usuarios() {
		super();
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getLogin() {
		return login;
	}

	public void setLogin(String login) {
		this.login = login;
	}

	public String getPswd() {
		return pswd;
	}

	public void setPswd(String pswd) {
		this.pswd = pswd;
	}

	public Pessoas getPessoa() {
		return pessoa;
	}

	public void setPessoa(Pessoas pessoa) {
		this.pessoa = pessoa;
	}

	public Perfis getPerfil() {
		return perfil;
	}

	public void setPerfil(Perfis perfil) {
		this.perfil = perfil;
	}

	public List<PlanoNegocio> getPlanoNegocios() {
		return planoNegocios;
	}

	public void setPlanoNegocios(List<PlanoNegocio> planoNegocios) {
		this.planoNegocios = planoNegocios;
	}
	

	public List<Analises> getAnalises() {
		return analises;
	}

	public void setAnalises(List<Analises> analises) {
		this.analises = analises;
	}




	public static Model.Finder<Integer, Usuarios> find =  new Finder<Integer, Usuarios>(Integer.class, Usuarios.class);
}
